<template>
	<view>
		<u-navbar title="我的车辆" bgColor="#3083FB" titleStyle="color:#fff" left-icon-color="#fff" :autoBack="true"
			placeholder></u-navbar>
		<view class="bg"></view>
		<view class="main">
			<u-radio-group placement="row" v-model="radioValue">

				<!-- 没有车的时候 -->
				<view class="nodata" v-if="list.length == 0">暂无车辆信息</view>
				<!-- 汽车列表 -->
				<view class="car-list" v-else>
					<view class="item">
						<view class="top">
							<view class="pic">
								<image src="/static/images/car.png" mode="aspectFill"></image>
							</view>
							<view class="text">
								<text>车型：奔驰-GR</text>
								<text>车牌：豫M35468</text>
							</view>
						</view>
						<view class="bottom">
							<u-radio activeColor="red" size="14" label="设置默认车辆" name="奔驰-GR1"></u-radio> <text>删除</text>
						</view>
					</view>

					<view class="item">
						<view class="top">
							<view class="pic">
								<image src="/static/images/car.png" mode="aspectFill"></image>
							</view>
							<view class="text">
								<text>车型：奔驰-GR2</text>
								<text>车牌：豫M35468</text>
							</view>
						</view>
						<view class="bottom">
							<u-radio activeColor="red" size="14" label="设置默认车辆" name="奔驰-GR2"></u-radio> <text>删除</text>
						</view>
					</view>

				</view>

			</u-radio-group>
		</view>
		<view class="addCar">
			<u-button type="primary" @click="onAddCar">
				<u-icon name="plus" color="#fff" size="14"></u-icon>
				<text class="text">添加车辆</text>
			</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 该数组放数据
				list: ['1'],
				radioValue: '奔驰-GR1',
			};
		},
		methods:{
			onAddCar(){
				uni.navigateTo({url:'/pages/My/MyCar/AddCar'})
			}
		}
	}
</script>

<style lang="scss">
	.bg {
		background-color: #3083FB;
		height: 200rpx;
		margin-top: -2px;
	}

	.main {
		padding: 20rpx;
		padding-top: 30rpx;
		margin-top: -190rpx;

		.nodata {
			width: 100%;
			border-radius: 18rpx;
			background-color: #fff;
			height: 1000rpx;
			background-image: url('/static/images/no-car.png');
			background-repeat: no-repeat;
			background-position: 50% 50%;
			color: #ccc;
			line-height: 1300rpx;
			text-align: center;
		}

		.car-list {
			width: 100%;

			.item {
				background-color: #fff;
				border-radius: 18rpx;
				padding: 30rpx 30rpx 10rpx;
				margin-bottom: 20rpx;

				.top {
					display: flex;
					margin-bottom: 50rpx;

					.pic {
						width: 120rpx;
						height: 120rpx;
						border-radius: 50%;
						overflow: hidden;

						image {
							width: 100%;
							height: 100%;
						}
					}

					.text {
						display: flex;
						flex-direction: column;
						justify-content: center;
						padding-left: 40rpx;

						text {
							&:nth-child(1) {
								font-size: 34rpx;
								margin-bottom: 10rpx;
								font-weight: bold;
							}

							&:nth-child(2) {
								font-size: 28rpx;
							}
						}
					}
				}

				.bottom {
					padding-bottom: 20rpx;
					display: flex;
					justify-content: space-between;
					color: #606266;
				}
			}
		}
	}

	// 添加按钮
	.addCar {
		width: 750rpx;
		box-sizing: border-box;
		position: fixed;
		bottom: 40rpx;
		padding: 0 20rpx;

		.text {
			margin-left: 20rpx;
		}

		/deep/ .u-button {
			background: linear-gradient(to right, #3789FF, #0362E6);
			border-radius: 40rpx !important;
		}
	}
</style>